<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<title>Map, Cell and Tile Properties</title>
<link rel="stylesheet" href="doc.css" type="text/css" />
</head>
<body>
<div class="document">
<div class="navigation navigation-header container">
<span class="previous">Previous: <a class="reference" href="xml_file_contents.html" title="XML file contents">XML file contents</a></span><span class="next">Next: <a class="reference" href="controlling_map_scrolling.html" title="Controlling Map Scrolling">Controlling Map Scrolling</a></span><span class="breadcrumbs"><a class="reference" href="index.html" title="Programming Guide">Programming Guide</a> » <a class="reference" href="tiled_maps.html" title="Tiled maps">Tiled maps</a> » Map, Cell ...</span></div>
<h1 class="title">Map, Cell and Tile Properties</h1>

<p>Most tags may additionally have properties specified as:</p>
<pre class="py-doctest">
&lt;property [type=<span class="py-string">&quot;&quot;</span>] name=<span class="py-string">&quot;&quot;</span> value=<span class="py-string">&quot;&quot;</span> /&gt;</pre>
<p>Where type is one of &quot;unicode&quot;, &quot;int&quot;, &quot;float&quot; or &quot;bool&quot;. The property will
be a unicode string by default if no type is specified.</p>
<p>Properties are accessed on the map, cell or tile using common dict operations
with some extensions. Accessing a property on a <strong>cell</strong> will fall back to look
on the <strong>tile</strong> if it's not found on the cell.</p>
<p>If a cell has a property <tt class="docutils literal"><span class="pre">player-spawn</span></tt> (boolean) and the tile that the cell
uses has a property <tt class="docutils literal"><span class="pre">move-cost=1</span></tt> (int) then the following are true:</p>
<pre class="py-doctest">
<span class="py-string">'player-spawn'</span> <span class="py-keyword">in</span> cell == True
cell.get(<span class="py-string">'player-spawn'</span>) == True
cell[<span class="py-string">'player-spawn'</span>] == True

<span class="py-string">'player-spawn'</span> <span class="py-keyword">in</span> tile == False
tile.get(<span class="py-string">'player-spawn'</span>) == None
tile[<span class="py-string">'player-spawn'</span>] --&gt; raises KeyError

cell[<span class="py-string">'move-cost'</span>] == 1</pre>
<p>You may additionally set properties on cells and tiles:</p>
<pre class="py-doctest">
cell[<span class="py-string">'player-postion'</span>] = True
cell[<span class="py-string">'burnt-out'</span>] = True</pre>
<p>and when the map is exported to XML these properties will also be exported.</p>
<div class="navigation navigation-footer container">
<span class="previous">Previous: <a class="reference" href="xml_file_contents.html" title="XML file contents">XML file contents</a></span><span class="next">Next: <a class="reference" href="controlling_map_scrolling.html" title="Controlling Map Scrolling">Controlling Map Scrolling</a></span><span class="breadcrumbs"><a class="reference" href="index.html" title="Programming Guide">Programming Guide</a> » <a class="reference" href="tiled_maps.html" title="Tiled maps">Tiled maps</a> » Map, Cell ...</span></div>
</div>
</body>
</html>
